<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
  String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>添加付款方式信息</title>

<base target="_self" />

<link href="<%=path1%>/ht/Styles/css.css" rel="stylesheet" type="text/css" />
<link href="<%=path1%>/ht/Styles/ts_css.css" rel="stylesheet" type="text/css" />
<script src="<%=path1%>/ht/Scripts/My97DatePicker/WdatePicker.js"
	type="text/javascript"></script>
<script src="<%=path1%>/ht/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="<%=path1%>/ht/Scripts/IndexManager.js" type="text/javascript"></script>
<!-- <script src="Scripts/jquery.min.js" type="text/javascript" ></script>
<script src="Scripts/jquery.validate.min.js" type="text/javascript" ></script> -->

<script type="text/javascript">
	//添加楼栋信息
 		
	function addAjax() {
		//alert("走了么");
		$.ajax({
					data : {
						pay_type_name : $("#pay_type_name").val(),
						apply_scope : $("#apply_scope").val(),
						pay_type_kind : $("#pay_type_kind").val(),
						explains : $("#explains").val(),
						discount : $("#discount").val()

					},
					type : "POST",
					datatype : 'json',
					url : "<%=path1%>/ht/pay_type/addPay_Type.do",
					error : function(data) {
						//alert(data);
						alert("出错了");
					},
					success : function(data) {
						/*jQuery.each(data.projectList,function(i,item){
						 alert(item.id+","+item.name);
						 }); */
						window.location.href = "<%=path1%>/ht/pay_type/selectAll.do";
					}
				});
	}

</script>
<script type="text/javascript">
  function breaks(){
	  window.location.href="<%=path1%>/ht/pay_type/selectAll.do";
	}
</script>
<script type="text/javascript">
	function pay_type_names() {

		var pay_type_name = document.getElementById("pay_type_name").value;
		
		if (pay_type_name == ""||pay_type_name==null) {
			//alert("付款方式名称不能为空");
			//pay_type_name.focus();
			return false;
		}
		return true;
	}

	function apply_scopes() {
		var apply_scope = $("#apply_scope").val();
		if (apply_scope == ""||apply_scope==null) {
			//alert("使用范围不能为空");
			//$("#apply_scope").focus();
			return false;
		}
		return true;
	}

	function pay_type_kinds() {
		var pay_type_kind = $("#pay_type_kind").val();
		if (pay_type_kind == "" || pay_type_kind==null) {
			//alert("付款方式类型不能为空");
			//$("#pay_type_kind").focus();
			return false;
		}
		return true;
	}

	function explainss() {
		var explains = $("#explains").val();
		if (explains == "" ||explains==null) {
			//alert("百分比不能为空");
			//$("#explains").focus();
			return false;
		}
		return true;
	}

	function discounts() {
		var discount = $("#discount").val();
		if (discount == "" || discount==null) {
			//alert("折扣不能为空");
			//$("#discount").focus();
			return false;
		}
		return true;
	}

</script> 
  <script type="text/javascript">
      function danji(){
    	  if(pay_type_names()==true & apply_scopes()==true & pay_type_kinds()==true & explainss()==true & discounts()==true){
    		  addAjax();
    	  }else{
    		  alert("红色星号为必填项！");
    	  }
      }
  </script>
</head>
<body>

	<form id="form1" method="post" name="form1">
		<div id="divTwo">
			<table width="100%" border="0" cellpadding="3" cellspacing="3"
				class="table_list1">
				<h2 align="center">添加付款方式信息</h2>
				<tr>
					<td width="50%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 付款方式名称:
					</td>
					<td width="50%" class="table_list1_style2"><input type="text"
						id="pay_type_name"  onblur="pay_type_names()"/></td>

				</tr>
				<tr>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 付款方式范围:
					</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						id="apply_scope"  onblur="apply_scopes()"/></td>
				</tr>
				<tr>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 付款方式类型:
					</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						id="pay_type_kind"  onblur="pay_type_kinds()"/></td>

				</tr>
				<tr>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 百分比:
					</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						 id="explains" onblur="explainss()"/>
						 </td>
				</tr>
				<tr>
					<td width="10%" class="table_list1_style1"><p></p> 折扣:</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						id="discount" onblur="discounts()" /></td>
				</tr>

				<tr>
					<td class="table_list1_style1">

						<p></p> <input type="button" id="send" value="添加" tabindex="1"
						class="button" onclick="danji();" /> &nbsp;
					</td>
					<td width="1%" class="table_list1_style2">

						<p></p> <input type="button" class="button" value="关闭"
						tabindex="1" onclick="breaks()" />
					</td>
					<td class="table_list1_style1">&nbsp;</td>
				</tr>
			</table>
		</div>
	</form>
</body>
</html>